<html>
<head><meta charset="utf-8"><title>rust-lld not found · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html">rust-lld not found</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203261267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203261267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203261267">(Jul 08 2020 at 12:31)</a>:</h4>
<p>I made a rustc build using this config:</p>
<div class="codehilite"><pre><span></span><code>[llvm]
targets = &quot;WebAssembly;X86&quot;

[build]
target = [&quot;x86_64-unknown-linux-gnu&quot;, &quot;wasm32-unknown-unknown&quot;]

[install]

[rust]
optimize = true
debug = true
codegen-units = 0
debug-assertions = true
debuginfo-level = 2

[target.x86_64-unknown-linux-gnu]
llvm-config = &quot;/usr/bin/llvm-config-10&quot;

[dist]
</code></pre></div>


<p>but it fails with this error:</p>
<div class="codehilite"><pre><span></span><code>$ ~/rust/rust/build/x86_64-unknown-linux-gnu/stage2/bin/rustc lib.rs --target=wasm32-unknown-unknown
error: linker `rust-lld` not found
  |
  = note: No such file or directory (os error 2)

error: aborting due to previous error
</code></pre></div>


<p>Any tips?</p>



<a name="203264910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203264910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tshepang Lekhonkhobe <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203264910">(Jul 08 2020 at 13:11)</a>:</h4>
<p>had the same, and was fixed by adding <code>rust.lld = true</code> to config.toml</p>



<a name="203265128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203265128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tshepang Lekhonkhobe <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203265128">(Jul 08 2020 at 13:13)</a>:</h4>
<p>sidenote: it was not clear whether I should that or <code>rust.use-lld = true</code> after reading descriptions in config.toml.example</p>



<a name="203267243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203267243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203267243">(Jul 08 2020 at 13:32)</a>:</h4>
<p>Thanks <span class="user-mention" data-user-id="119529">@Tshepang Lekhonkhobe</span> , that fixed the issue. I'm not getting </p>
<div class="codehilite"><pre><span></span><code>$ ~/rust/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc lib.rs --target=wasm32-unknown-unknown
error[E0463]: can&#39;t find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed

error: aborting due to previous error
</code></pre></div>


<p>I guess I have to add wasm to <code>host</code> as well? (That's the only relevant field other than the ones I updated I think)</p>



<a name="203267360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203267360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203267360">(Jul 08 2020 at 13:33)</a>:</h4>
<p>That doesn't seem to work -- huge wall of error printed</p>



<a name="203267442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203267442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tshepang Lekhonkhobe <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203267442">(Jul 08 2020 at 13:34)</a>:</h4>
<p>I found I had to <code>x.py clean</code> to avoid errors</p>



<a name="203267499"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203267499" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Tshepang Lekhonkhobe <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203267499">(Jul 08 2020 at 13:34)</a>:</h4>
<p>... no need to add wasm to host</p>



<a name="203267933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203267933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203267933">(Jul 08 2020 at 13:38)</a>:</h4>
<p>/me tries <code>x.py clean</code></p>



<a name="203270477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203270477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203270477">(Jul 08 2020 at 14:00)</a>:</h4>
<p>Tried with <code>clean</code> -- if I add wasm to host then it doesn't build. If I don't I get a stage 2 build, but it fails with "can't find crate 'core'"</p>



<a name="203273680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203273680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203273680">(Jul 08 2020 at 14:26)</a>:</h4>
<p>What x.py command did you use to build the compiler?</p>



<a name="203273712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203273712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203273712">(Jul 08 2020 at 14:26)</a>:</h4>
<p><code>x.py build</code></p>



<a name="203275007"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203275007" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203275007">(Jul 08 2020 at 14:37)</a>:</h4>
<p>If you ran just <code>x.py build</code>, then that built a stage2 compiler, and the wasm32 target is in the stage2 directory.  The error message you posted says it ran the <code>stage1</code> compiler, which won't have the target.</p>



<a name="203275096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203275096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> osa1 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203275096">(Jul 08 2020 at 14:37)</a>:</h4>
<p>Ahh, you're right. I can compile if I use stage 2 compiler thanks.</p>



<a name="203282931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/rust-lld%20not%20found/near/203282931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/rust-lld.20not.20found.html#203282931">(Jul 08 2020 at 15:36)</a>:</h4>
<p><span class="user-mention" data-user-id="119169">@osa1</span> if you want to use <code>stage1/bin/rustc</code> w/ the non-host targets you presumably need to pass <code>--stage 1</code> to <code>x.py build</code></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>